#include <iostream>
using namespace std;
using ll =long long int;
const int N=135+10;
ll ret=0;
ll n,a;
ll gcd(ll num1,ll num2)
{
    return num2==0?num1:gcd(num2,num1%num2);
}

int main() 
{
    while(cin>>n>>a)
    {
        ret=a;
        for(int i=0;i<n;i++)
        {
            ll b;cin>>b;
            if(b<=ret)
            {
                ret+=b;
            }
            else
            {
                ret+=gcd(b,ret);
            }
        }
        cout<<ret<<endl;
    }

}
// 64 位输出请用 printf("%lld")